﻿#pragma once

#include <glm/glm.hpp>

namespace Hazal
{
	class COrthoGraphicCamera
	{
	public:
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="fleft">fovX-Left</param>
		/// <param name="fRight">fovX-Right</param>
		/// <param name="fBottom">fovY-Bottom</param>
		/// <param name="fTop">fovY-Top</param>
		COrthoGraphicCamera(float fleft, float fRight, float fBottom, float fTop);

		/// <summary>
		/// 设置相机位置
		/// </summary>
		void SetPosition(const glm::vec3& vecPosition);

		/// <summary>
		/// 获取相机位置
		/// </summary>
		/// <returns></returns>
		const glm::vec3& GetPosition() const;

		/// <summary>
		/// 获取视图矩阵
		/// </summary>
		/// <returns></returns>
		const glm::mat4& GetViewMatrix() const;

		/// <summary>
		/// 设置投影矩阵
		/// </summary>
		/// <param name="fleft">Left</param>
		/// <param name="fRight">Right</param>
		/// <param name="fBottom">Bottom</param>
		/// <param name="fTop">Top</param>
		void SetProjectionMatrix(float fleft, float fRight, float fBottom, float fTop);

		/// <summary>
		/// 获取透视投影矩阵(Ortho)
		/// </summary>
		/// <returns></returns>
		const glm::mat4& GetProjectionMatrix() const;

		/// <summary>
		/// 获取视图矩阵和投影矩阵计算的结果
		/// </summary>
		/// <returns></returns>
		const glm::mat4& GetViewProjMatrix() const;

		/// <summary>
		/// 设置旋转角度
		/// </summary>
		/// <param name="fRotation"></param>
		void SetRotation(float fRotation);

		/// <summary>
		/// 获取旋转角度
		/// </summary>
		/// <returns></returns>
		const float GetRotation() const;

	private:
		void RecalculateMatrix();

	private:
		glm::mat4 m_projectMatrix;	///< 投影矩阵
		glm::mat4 m_viewMatrix;		///< 视图矩阵
		glm::mat4 m_viewProjMatrix;	///< 投影矩阵和视图矩阵变换后的矩阵(VP matrix)

		glm::vec3 m_positionVec;
		float m_fRotation;
	};
}
